import { defineStore } from "pinia";
import axios from 'axios'
import {ChannelList,ChannelRes} from '../../types'
export default defineStore('channels',{
 state() {
     return{
       list :[] as ChannelRes,
       active:-1
     }
 },
 actions:{
 async getChannel(){
        const res = await axios.get<ChannelList>('http://geek.itheima.net/v1_0/channels')
        this.list = res.data.data.channels
        this.active = res.data?.data?.channels?.[0]?.id
  },
  changeActive(active :number){
    this.active = active
  }
 },
 getters:{}
})